package com.example.springboothomework.entity.excel;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.*;
import java.time.LocalDate;

/**
 *
 * @author chenjianhao
 * @date 2025/6/10
 * 员工导入类
 */
@Getter
@Setter
public class EmployeeExcelImport {

    /**
     * 员工姓名
     */
    @NotBlank(message = "员工姓名不能为空")
    @Size(min = 2, max = 100, message = "员工姓名长度需在2-100字符之间")
    @Pattern(regexp = ".*\\S.*", message = "员工姓名不能全为空白字符")
    @ExcelProperty(value ="员工姓名",order=1)
    private String name;

    /**
     * 年龄
     */
    @NotNull(message = "年龄不能为空")
    @ExcelProperty(value ="年龄",order=2)
    private Integer age;

    /**
     * 入职日期
     */
    @NotNull(message = "入职日期不能为空")
    @PastOrPresent(message = "入职日期不能是未来时间")
    @ExcelProperty(value ="入职日期",order=3)
    @DateTimeFormat("yyyy-MM-dd")
    private LocalDate employmentDate;



    /**
     * 在职状态
     */
    @NotNull(message = "在职状态不能为空")
    @ExcelProperty(value ="在职状态",order=4)
    private Boolean employed;

    /**
     * 所属公司
     */
    @NotNull(message = "所属公司名称不能为空")
    @ExcelProperty(value ="所属公司",order=5)
    private String companyName;

    @Override
    public String toString() {
        return "EmployeeExcelImport{" +
                "name='" + name + '\'' +
                ", employmentDate=" + employmentDate +
                ", age=" + age +
                ", employed=" + employed +
                ", companyName=" + companyName +
                '}';
    }
}
